package priv.ln._enum.exer;

/**
 * ClassName: Color
 * Package: priv.ln._enum.exer
 * Description:
 * - 声明final修饰的int类型的属性red,green,blue
 * - 声明final修饰的String类型的属性description
 * - 声明有参构造器Color(int red, int green, int blue,String description)
 * - 创建7个常量对象：红、橙、黄、绿、青、蓝、紫，
 * - 重写toString方法，例如：RED(255,0,0)->红色
 *
 * - 7个常量对象的RGB值如下：
 * 红：(255,0,0)
 * 橙：(255,128,0)
 * 黄：(255,255,0)
 * 绿：(0,255,0)
 * 青：(0,255,255)
 * 蓝：(0,0,255)
 * 紫：(128,0,255)
 *
 * 7个常量对象名如下：
 * RED, ORANGE, YELLOW, GREEN, CYAN, BLUE,PURPLE
 * @Author 辣辣
 * @Create 2024/7/12 14:34
 * @Version 1.0
 */
public enum Color {
    RED(255,0,0,"红色"),
    ORANGE(255,128,0,"橙色"),
    YELLOW(255,255,0,"黄色"),
    GREEN(0,255,0,"绿色"),
    CYAN(0,255,255,"青色"),
    BLUE(0,0,255,"蓝色"),
    PURPLE(128,0,255,"紫色");

    private final int red;
    private final int green;
    private final int blue;
    private final String description;//颜色的描述

    Color(int red, int green, int blue, String description) {
        this.red = red;
        this.green = green;
        this.blue = blue;
        this.description = description;
    }

    public int getRed() {
        return red;
    }

    public int getGreen() {
        return green;
    }

    public int getBlue() {
        return blue;
    }

    public String getDescription() {
        return description;
    }

    @Override
    public String toString() {
//        return name() + "(" + red + "," + green + "," + blue + ")->" + description;
        return super.toString() + "(" + red + "," + green + "," + blue + ")->" + description;
    }
}
